package com.dragon.modules.yuegou.query.product;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dragon.modules.yuegou.entity.product.SeckillRecordEntity;
import com.dragon.modules.yuegou.enums.product.SeckillRecordStatus;
import com.dragon.modules.yuegou.mybatis.Condition;
import com.dragon.modules.yuegou.mybatis.Query;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

import java.time.LocalDateTime;

/**
 *  动态查询条件
 * 
 * @author ljf
 * @date 2019-07-29 14:24:32
 * @version 2.0
 */
@JsonInclude(Include.NON_NULL)
public class SeckillRecordQuery extends SeckillRecordEntity implements Query<SeckillRecordEntity> {

    /** 查询条件 */
	@JsonUnwrapped(prefix = "id")
	private Condition<String> idCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "seckillId")
	private Condition<String> seckillIdCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "busdId")
	private Condition<String> busdIdCondition;

    /** 购买的日期查询条件 */
	@JsonUnwrapped(prefix = "buyTime")
	private Condition<LocalDateTime> buyTimeCondition;

    /** [枚举]状态：0-正常-NORMAL、1-退款-DISABLE查询条件 */
	@JsonUnwrapped(prefix = "status")
	private Condition<SeckillRecordStatus> statusCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "memberId")
	private Condition<String> memberIdCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "orderNo")
	private Condition<String> orderNoCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "orderTime")
	private Condition<LocalDateTime> orderTimeCondition;

	/**
	 * 构造一个查询条件对象
	 */
	public SeckillRecordQuery() {
		super();
	}

	/**
	 * 依据实体对象构造一个查询条件对象
	 * 
	 * @param entity 实体对象
	 */
	public SeckillRecordQuery(SeckillRecordEntity entity) {
		super(entity);
	}

	/**
	 * 依据其它查询条件对象的信息构造一个查询条件对象
	 * 
	 * @param other 查询条件对象
	 */
	public SeckillRecordQuery(SeckillRecordQuery other) {
		super(other);
		if(other.idCondition != null) {
			this.idCondition = other.idCondition.copy();
		}
		if(other.seckillIdCondition != null) {
			this.seckillIdCondition = other.seckillIdCondition.copy();
		}
		if(other.busdIdCondition != null) {
			this.busdIdCondition = other.busdIdCondition.copy();
		}
		if(other.buyTimeCondition != null) {
			this.buyTimeCondition = other.buyTimeCondition.copy();
		}
		if(other.statusCondition != null) {
			this.statusCondition = other.statusCondition.copy();
		}
		if(other.memberIdCondition != null) {
			this.memberIdCondition = other.memberIdCondition.copy();
		}
		if(other.orderNoCondition != null) {
			this.orderNoCondition = other.orderNoCondition.copy();
		}
		if(other.orderTimeCondition != null) {
			this.orderTimeCondition = other.orderTimeCondition.copy();
		}
	}

	@Override
	public QueryWrapper<SeckillRecordEntity> toQueryWrapper() {
		QueryWrapper<SeckillRecordEntity> wrapper = new QueryWrapper<>(this);
		if (idCondition != null) {
			idCondition.toWrapper(wrapper, COL_ID);
		}
		if (seckillIdCondition != null) {
			seckillIdCondition.toWrapper(wrapper, COL_SECKILL_ID);
		}
		if (busdIdCondition != null) {
			busdIdCondition.toWrapper(wrapper, COL_BUSD_ID);
		}
		if (buyTimeCondition != null) {
			buyTimeCondition.toWrapper(wrapper, COL_BUY_TIME);
		}
		if (statusCondition != null) {
			statusCondition.toWrapper(wrapper, COL_STATUS);
		}
		if (memberIdCondition != null) {
			memberIdCondition.toWrapper(wrapper, COL_MEMBER_ID);
		}
		if (orderNoCondition != null) {
			orderNoCondition.toWrapper(wrapper, COL_ORDER_NO);
		}
		if (orderTimeCondition != null) {
			orderTimeCondition.toWrapper(wrapper, COL_ORDER_TIME);
		}
		return wrapper;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> id() {
		this.idCondition = new Condition<>();
		return this.idCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> getIdCondition() {
		return idCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param idCondition 查询条件
	 */
	public void setIdCondition(Condition<String> idCondition) {
		this.idCondition = idCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return seckillIdCondition 查询条件
	 */
	public Condition<String> seckillId() {
		this.seckillIdCondition = new Condition<>();
		return this.seckillIdCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return seckillIdCondition 查询条件
	 */
	public Condition<String> getSeckillIdCondition() {
		return seckillIdCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param seckillIdCondition 查询条件
	 */
	public void setSeckillIdCondition(Condition<String> seckillIdCondition) {
		this.seckillIdCondition = seckillIdCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return busdIdCondition 查询条件
	 */
	public Condition<String> busdId() {
		this.busdIdCondition = new Condition<>();
		return this.busdIdCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return busdIdCondition 查询条件
	 */
	public Condition<String> getBusdIdCondition() {
		return busdIdCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param busdIdCondition 查询条件
	 */
	public void setBusdIdCondition(Condition<String> busdIdCondition) {
		this.busdIdCondition = busdIdCondition;
	}

	/**
	 * 构造并返回购买的日期查询条件
	 * 
	 * @return buyTimeCondition 购买的日期查询条件
	 */
	public Condition<LocalDateTime> buyTime() {
		this.buyTimeCondition = new Condition<>();
		return this.buyTimeCondition;
	}
	
	/**
	 * 获取购买的日期查询条件
	 * 
	 * @return buyTimeCondition 购买的日期查询条件
	 */
	public Condition<LocalDateTime> getBuyTimeCondition() {
		return buyTimeCondition;
	}

	/**
	 * 设置购买的日期查询条件
	 * 
	 * @param buyTimeCondition 购买的日期查询条件
	 */
	public void setBuyTimeCondition(Condition<LocalDateTime> buyTimeCondition) {
		this.buyTimeCondition = buyTimeCondition;
	}

	/**
	 * 构造并返回[枚举]状态：0-正常-NORMAL、1-退款-DISABLE查询条件
	 * 
	 * @return statusCondition [枚举]状态：0-正常-NORMAL、1-退款-DISABLE查询条件
	 */
	public Condition<SeckillRecordStatus> status() {
		this.statusCondition = new Condition<>();
		return this.statusCondition;
	}
	
	/**
	 * 获取[枚举]状态：0-正常-NORMAL、1-退款-DISABLE查询条件
	 * 
	 * @return statusCondition [枚举]状态：0-正常-NORMAL、1-退款-DISABLE查询条件
	 */
	public Condition<SeckillRecordStatus> getStatusCondition() {
		return statusCondition;
	}

	/**
	 * 设置[枚举]状态：0-正常-NORMAL、1-退款-DISABLE查询条件
	 * 
	 * @param statusCondition [枚举]状态：0-正常-NORMAL、1-退款-DISABLE查询条件
	 */
	public void setStatusCondition(Condition<SeckillRecordStatus> statusCondition) {
		this.statusCondition = statusCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return memberIdCondition 查询条件
	 */
	public Condition<String> memberId() {
		this.memberIdCondition = new Condition<>();
		return this.memberIdCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return memberIdCondition 查询条件
	 */
	public Condition<String> getMemberIdCondition() {
		return memberIdCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param memberIdCondition 查询条件
	 */
	public void setMemberIdCondition(Condition<String> memberIdCondition) {
		this.memberIdCondition = memberIdCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return orderNoCondition 查询条件
	 */
	public Condition<String> orderNo() {
		this.orderNoCondition = new Condition<>();
		return this.orderNoCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return orderNoCondition 查询条件
	 */
	public Condition<String> getOrderNoCondition() {
		return orderNoCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param orderNoCondition 查询条件
	 */
	public void setOrderNoCondition(Condition<String> orderNoCondition) {
		this.orderNoCondition = orderNoCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return orderTimeCondition 查询条件
	 */
	public Condition<LocalDateTime> orderTime() {
		this.orderTimeCondition = new Condition<>();
		return this.orderTimeCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return orderTimeCondition 查询条件
	 */
	public Condition<LocalDateTime> getOrderTimeCondition() {
		return orderTimeCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param orderTimeCondition 查询条件
	 */
	public void setOrderTimeCondition(Condition<LocalDateTime> orderTimeCondition) {
		this.orderTimeCondition = orderTimeCondition;
	}

}
